package data
{
	import enum.StatusEnum;

	public class OrderData
	{
		
		
		/**
		 * 名字 
		 */		
		public var name:String = "";
		/**
		 * 电话 
		 */		
		public var phone:uint = 0;
		/**
		 * 订购数量 
		 */		
		public var num:uint = 0;
		/**
		 * 状态	0：未发货， 1：发货， 2：退款， 3：未知 
		 */		
		public var _status:uint = 0;
		/**
		 * 定金 
		 */		
		public var deposit:Number = 0;
		/**
		 * 订购时间 
		 */		
		public var _orderTime:Number = 0;
		/**
		 * 取货时间
		 */		
		public var _receiveTime:Number = 0;
		
		
		
		
		
		private var DayChinese:Array = ["日", "一", "二", "三", "四", "五", "六"];
		public function OrderData()
		{
			
			
						
		}
		
		public function setXML(xml1:XML):void{
			name = String(xml1.@name);
			phone = uint(xml1.@phone);
			num = uint(xml1.@num);
			_status = uint(xml1.@status);
			deposit = Number(xml1.@deposit);
			_orderTime = Number(xml1.@orderTime);
			_receiveTime = Number(xml1.@receiveTime);
		}
		
		public function setReceiveTime(date1:Date):void{
			_receiveTime = date1.getTime();
		}
		
		/**
		 * 状态	0：未发货， 1：发货， 2：退款， 3：未知 
		 */
		public function setStatus(v:uint):void{
			_status = v;
		}
		
		public function get receiveTime():String{
			var date1:Date;
			if(_receiveTime == 0){
//				date1 = new Date();
				return "未取货";
			}else{
				date1 = new Date(_receiveTime);
			}
			return date1.getUTCFullYear().toString() + "年 " + (date1.getUTCMonth() + 1) + "月 " + date1.getUTCDate() + "日 " + "星期" + DayChinese[date1.getUTCDay()];
		}
		public function get orderTime():String{
			var date1:Date = new Date(_orderTime);
			return date1.getUTCFullYear().toString() + "年 " + (date1.getUTCMonth() + 1) + "月 " + date1.getUTCDate() + "日 " + "星期" + DayChinese[date1.getUTCDay()];

		}
		public function get status():String{
			switch (_status){				
				case StatusEnum.NO_DELIVERY:
					return "未发货";
					break;
				case StatusEnum.DELIVERY:
					return "已发货";
					break;
				case StatusEnum.REFUND:
					return "已退钱";
					break;
				default:
					return "未知";
					break;
			}
		}
		
	}
}